<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
	<canvas id="canvas" width="1024" height="768" style="border: 1px solid #aaa; display: block; margin: auto auto">
		<!--兼容降错-->
		当前浏览器不支持 Canvas，请更换浏览器后再试
	</canvas>

	<!--直线-->
	<script>
	window.onload = function () {
		// 直线
		const canvas = document.getElementById('canvas')
		const context = canvas.getContext('2d')

		// 状态设置
		context.moveTo(100, 100)	// 笔尖移动
		context.lineTo(700, 700)	// 画笔移动到这点

		context.stroke()	// 开始绘制
	}
	</script>
</body>
</html>
